// Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
//
// Licensed under the Mulan PSL v2.
// You can use this file according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of the License at
//
//     http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
// FOR MORE DETAILS.

/*
 * @Author: qiulin 1746365080@qq.com
 * @Date: 2024-11-05 10:56:25
 * @LastEditors: pengtianrui 2276608413@qq.com
 * @LastEditTime: 2024-12-23 16:10:56
 * @FilePath: /SGSim/Import/BDFImport/UnitTest/PARAMETER/PARAMETERTest.cpp
 */

#include "gtest/gtest.h"

#include "DBManager/DBServiceFactory.h"
#include "DBManager/IService/Input/Parameter/IHYBDAMPService.h"

#include "Import/BDFImport/BulkData/Parameter/HYBDAMPParser.h"

using namespace SG::DataStructure::FEM;
#include "Import/BDFImport/BDFParserBase.h"
using namespace SG::DBManager;
using namespace SG::Import;
extern std::shared_ptr<DBServiceFactory> DB_SERVICEFACTORY;
extern std::vector<std::string>          dividedEntryInfo;

class HYBDAMPTest : public ::testing::Test
{
  public:
    static void SetUpTestSuite ()
    {
        DB_SERVICEFACTORY->ClearDatabase ();
    }
};

TEST_F (HYBDAMPTest, ParserEntry)
{
    // 1 假设BDF文件文本内容，通过解析函数加入到数据库中（需要更改）
    //$1234567$1234567$1234567$1234567$1234567$1234567
    std::vector<std::string> Entry = { "HYBDAMP 101     2000    2001             YES    " };
    BDF::divideBulkEntry (Entry, dividedEntryInfo);
    SG::Import::BDF::BULKDATA::ParseHYBDAMP (DB_SERVICEFACTORY, dividedEntryInfo);

    SG::DataStructure::FEM::HYBDAMPData tempData;
    DB_SERVICEFACTORY->get<IHYBDAMPService> ()->FindById (101, tempData);

    SG::DataStructure::FEM::HYBDAMPData tempData2;
    tempData2.m_id        = 101;
    tempData2.m_METHOD    = 2000;
    tempData2.m_SDAMP     = 2001;
    tempData2.m_KDAMP[0]  = 'N';
    tempData2.m_KDAMP[1]  = 'O';
    tempData2.m_PRTEIG[0] = 'Y';
    tempData2.m_PRTEIG[1] = 'E';
    tempData2.m_PRTEIG[2] = 'S';
    tempData2.m_domainId  = 1;
    ASSERT_TRUE (tempData2 == tempData);
}
